<?php

$user = new User(getInput("id"));

if (!$_REQUEST["id"]){
	$_REQUEST["created"] = time();
}

if (isset($_REQUEST["active"])){
	$_REQUEST["active"] = true;
}
else{
	$_REQUEST["active"] = false;
}


if (isset($_REQUEST["admin"])){
	$_REQUEST["admin"] = true;
}
else{
	$_REQUEST["admin"] = false;
}

$_REQUEST["lang"] = getLanguage();

if (isset($_REQUEST["password"])){
	$_REQUEST["password"] = $user->getPassword($_REQUEST["password"]);
}



if($user->insertFieldsFromRequest()){
	logSuccess(langEcho("user:save:success"));
	echoJsonResponse(true,WWWROOT . "admin/users.php" );
}else{
	echoJsonResponse(false );
}




?>